import repuest from '@/utils/request'
// 平台属性列表attrInfoList  GET     /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
// 删除平台属性deleteAttr    DELETE  /admin/product/deleteAttr/{attrId}
// 保存平台属性saveAttrInfo  POST    /admin/product/saveAttrInfo


export interface AttrValueModel {
    id?: number,
    valueName: string,
    attrId?: number,
    inputVisible?: boolean,// 这个数据只在前端交互使用
    
}

export interface AttrModel {
    id?: number,
    attrName: string,
    categoryId: number | undefined,
    categoryLevel: number,
    attrValueList: AttrValueModel[], // 属性值列表
    // -----------------------------
    // 用来收集平台属性id和属性值id
    attrIdvalId?: string
}
export default {
    attrInfoList(category1Id: number, category2Id: number, category3Id: number) {
        return repuest.get<any, AttrModel[]>(`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`)
    },
    saveAttr(data: AttrModel) {
        return repuest.post<any, null>(`/admin/product/saveAttrInfo`, data)
    },
    deleteAttr(attrId: number) {
        return repuest.delete<any, null>(`/admin/product/deleteAttr/${attrId}`)
    }
}